/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package radio.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Huu Vinh
 */
@Entity
@Table(name = "FeedbackType", catalog = "Radio_Cabs", schema = "dbo", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"FBName"})})
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FeedbackType.findAll", query = "SELECT f FROM FeedbackType f"),
    @NamedQuery(name = "FeedbackType.findByFBTypeId", query = "SELECT f FROM FeedbackType f WHERE f.fBTypeId = :fBTypeId"),
    @NamedQuery(name = "FeedbackType.findByFBName", query = "SELECT f FROM FeedbackType f WHERE f.fBName = :fBName")})
public class FeedbackType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "FBTypeId", nullable = false)
    private Integer fBTypeId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "FBName", nullable = false, length = 50)
    private String fBName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fBTypeId")
    private List<Feedback> feedbackList;

    public FeedbackType() {
    }

    public FeedbackType(Integer fBTypeId) {
        this.fBTypeId = fBTypeId;
    }

    public FeedbackType(Integer fBTypeId, String fBName) {
        this.fBTypeId = fBTypeId;
        this.fBName = fBName;
    }

    public Integer getFBTypeId() {
        return fBTypeId;
    }

    public void setFBTypeId(Integer fBTypeId) {
        this.fBTypeId = fBTypeId;
    }

    public String getFBName() {
        return fBName;
    }

    public void setFBName(String fBName) {
        this.fBName = fBName;
    }

    @XmlTransient
    public List<Feedback> getFeedbackList() {
        return feedbackList;
    }

    public void setFeedbackList(List<Feedback> feedbackList) {
        this.feedbackList = feedbackList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (fBTypeId != null ? fBTypeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FeedbackType)) {
            return false;
        }
        FeedbackType other = (FeedbackType) object;
        if ((this.fBTypeId == null && other.fBTypeId != null) || (this.fBTypeId != null && !this.fBTypeId.equals(other.fBTypeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "radio.entities.FeedbackType[ fBTypeId=" + fBTypeId + " ]";
    }
    
}
